
///代码清单1-2
///代码路径 helloworld/lib/main.dart
import 'package:flutter/material.dart';
void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    //根视图
    return MaterialApp(
      //应用主题
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      //应用默认显示的页面
      home: const MyHomePage(),
    );
  }
}

//应用显示的第一个页面
class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key}) : super(key: key);
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    //页面脚手架
    return Scaffold(
      //标题
      appBar: AppBar(
        title: const Text("第一个Flutter应用程序"),
      ),
      //中间显示的一个文本
      body: const Center(
        child: Text(
          "Hello World",
          //文本样式
          style: TextStyle(
            //文本大小
              fontSize: 33,
              //文本加粗
              fontWeight: FontWeight.bold),
        ),
      ),
    );
  }
}

